// 1619. 删除某些元素后的数组均值
/**
 * @param {number[]} arr
 * @return {number}
 */
var trimMean = function (arr) {
	arr.sort((a, b) => a - b)
	const len = arr.length
	const temp = Math.floor(len * 0.05)
	arr = arr.slice(temp, len - temp)
	const total = arr.reduce((prev, next) => prev + next)
	return total / arr.length
}
var trimMean = function (arr) {
	const n = arr.length
	arr.sort((a, b) => a - b)
	let sum = 0
	/* 
        [n/20,19n/20)
    */
	for (let i = n / 20; i < (19 * n) / 20; i++) {
		sum += arr[i]
	}
	return sum / (n * 0.9)
}
trimMean([6, 2, 7, 5, 1, 2, 0, 3, 10, 2, 5, 0, 5, 5, 0, 8, 7, 6, 8, 0])
